vim.cmd [[
  function! EatSpace() abort
    return (nr2char(getchar(0)) =~ '\s') ? '' : c
  endfunc
  iabbr <silent> if if ()<Left><C-R>=Eatchar('\s')<CR>
]]

local abbrev_utils = {
  make_c_mappings = function()
    for _, keyword in ipairs { "if", "for", "while", "switch" } do
      vim.cmd("inoreabbrev <buffer> <silent> " .. keyword .. " " .. keyword .. " ()<left><C-R>=EatSpace()<cr>")
    end
  end,
}

return abbrev_utils
